JavaScript Ends with

endsWith() returns true if the string finishes with the given characters, false otherwise. It is the mirror of startsWith() and is handy for testing file extensions or suffixes. Case-sensitive.

Syntax

str.endsWith(search)

Examples

Input Arguments Output
"image.png" ".png" true

When to use it

  • Validate file extensions.
  • Detect trailing markers or units.

Try it live

Type your input and see Ends with transform it instantly.

Description: Checks if a string ends with a specified substring.

Example: 'ice cream'.endsWith('cream') => true

Want to go further? Chain Ends with with other functions in the visual Playground — pipe one output into the next and watch your data transform.

Related functions

© 2026 Heifara Buval